import requests
import re
from urllib3.exceptions import InsecureRequestWarning
import datetime

# 禁用安全请求警告
Platform = "暴走_情眯小说"
today = datetime.date.today()  # 今天
yester = today - datetime.timedelta(days=1)


def baozou4():
    try:
        requests.urllib3.disable_warnings(InsecureRequestWarning)
        r = requests.session()
        data = {
            "account": "",
            "password": ""
        }
        rr = r.post(url="http://www.niuniutui.com/api/checklogin", data=data, verify=False, timeout=15)
        ht = r.get(url="https://wncps.niuniutui.com/index/datacenter/dayincome", verify=False, timeout=15)
        html = ht.text.replace('\r', '').replace('\t', '').replace('\n', '')
        date_time = str(yester)
        Amount_share = re.findall('昨日分成：￥(.*?)</p>', html)[0]
        return date_time, Amount_share, Platform
    except Exception:
        print("获取 暴走_情眯小说 数据失败")
        return '', 'None', Platform
    except ConnectionError:
        print("获取 暴走_情眯小说 数据 超时")
        return '', 'None', Platform
